package com.ymatou.iapi.userservice.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.userservice.parameter.enums.AppSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.ThirdPartyTypeEnum;
import com.ymatou.iapi.userservice.parameter.req.BindThirdPartyUserReq;
import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymatou.iapi.userservice.parameter.req.QueryThirdPartyBindInfoByThirdPartyIdReq;
import com.ymatou.iapi.userservice.service.ThirdPartyBindInfoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;

/**
 * FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_ThirdPartyBindInfo {
	private static QueryThirdPartyBindInfoByThirdPartyIdReq queryThirdPartyBindInfoByThirdPartyIdReq;
	private static ThirdPartyBindInfoCall thirdPartyBindInfoCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询第三方绑定信息");
	}

	@Before
	public void caseUp() {
		queryThirdPartyBindInfoByThirdPartyIdReq = new QueryThirdPartyBindInfoByThirdPartyIdReq();
		thirdPartyBindInfoCall = new ThirdPartyBindInfoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(thirdPartyBindInfoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_001() {
		Logger.start(true, "查询第三方绑定信息WeiXin,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.WeiXin);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_002() {
		Logger.start(true, "查询第三方绑定信息Weibo,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.Weibo);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.Weibo);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_003() {
		Logger.start(true, "查询第三方绑定信息Alipay,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.Alipay);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_004() {
		Logger.start(false, "ThirdPartyId不输入,失败");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(bd);
//			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.Alipay);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("false", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("100", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_005() {
		Logger.start(false, "RegSource不输入,成功JIRACONN-12493");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
//			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.Alipay);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_006() {
		Logger.start(true, "setPartyType查询第三方绑定信息WeiXin,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.WeiXin);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_007() {
		Logger.start(true, "setPartyType查询第三方绑定信息Weibo,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.Weibo);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.Weibo);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_008() {
		Logger.start(true, "setPartyType查询第三方绑定信息Alipay,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.Alipay);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.App);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.Alipay);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_009() {
		Logger.start(true, "查询第三方绑定信息WeiXin,成功GlobalApp");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			bd.setAppSource(AppSourceEnum.GlobalApp);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.GlobalApp);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.WeiXin);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ThirdPartyBindInfo_010() {
		Logger.start(true, "查询第三方绑定信息WeiXin,成功GlobalWxApp");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			BindThirdPartyUserReq bd = JUserCallService.initBindThirdUserReq(uid);
			bd.setThirdPartyType(ThirdPartyTypeEnum.WeiXin);
			bd.setAppSource(AppSourceEnum.GlobalWxApp);
			JUserCallService.bindThirdPartyUserCall(bd);
			queryThirdPartyBindInfoByThirdPartyIdReq.setThirdPartyId(bd.getThirdPartyId());
			queryThirdPartyBindInfoByThirdPartyIdReq.setRegSource(AppSourceEnum.GlobalWxApp);
			queryThirdPartyBindInfoByThirdPartyIdReq.setPartyType(ThirdPartyTypeEnum.WeiXin);
			thirdPartyBindInfoCall.setData(queryThirdPartyBindInfoByThirdPartyIdReq);
			thirdPartyBindInfoCall.callService();
			Logger.verifyEquals("true", thirdPartyBindInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", thirdPartyBindInfoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}